package com.onefish.toolkit.filter;

import org.apache.commons.lang3.StringEscapeUtils;

//import org.apache.commons.text.StringEscapeUtils;

public class SpecialCharacterFilter {
    public static void main(String[] args) {
        String input = "This is a test string with & && | || ; () <> special characters";

        // 使用 escapeJava 方法过滤特殊字符
        String filteredOutput = StringEscapeUtils.escapeJava(input)
                .replaceAll("&", "")
                .replaceAll("\\|", "")
                .replaceAll(";", "")
                .replaceAll("\\(\\)", "")
                .replaceAll("\\<\\>","");

        System.out.println("Filtered output: " + filteredOutput);
    }
}
